package jvm

/**
 * @Author: DRevelation
 * @Date: 2021/9/22 14:45
 */
/**
 * 可变参数
 */
fun vars(vararg args: String) {
    for (arg in args) {
        print(arg)
    }
}

/**
 * 匿名函数
 * /** 支持嵌套 */
 */
val sumLambda: (Int, Int) -> Int = { x, y -> x + y }

fun decimalDigitValue(c: Char): Int {
    if (c !in '0'..'9') {
        throw IllegalArgumentException("Out of range")
    }
    return c.code - '0'.code
}

fun main() {
    vars("a", "b", "c")
    println(sumLambda(1, 2))

    var a = 1
    val s1 = "a is $a"
    a = 2
    val s2 = "${s1.replace("is", "was")}, but now is $a"
    println(s2)

    for (i in 0 until 10) print("$i ")
    for (i in 1..10 step 3) println(i)

    val b = 8.shr(2)
    println(b)
}